$(document).ready(function(){
	activeMenu('10', '13');
	$('table#userDictionary tr:last-child').addClass('last');
});
function addDictionaryItem() {
	if ($('#abbreviation').val() != '' && $('#replacedText').val() != '') {
		var submitData = $('#addWordForm').formSerialize();
		$.ajax ({
			type: 	 "POST",
			url:	 "addItemAjax?set_ajax_view",
			data:	 submitData,
			success: function(data) {
				if (data == 0) {
					$('#abbreviation').val(_("Duplicated data!"));
					$('#replacedText').val("");	
				} else {
					$('table#userDictionary tbody').append(data);
					$('#abbreviation').val("");
					$('#replacedText').val("");
				}
				$('table#userDictionary tr').removeClass('last');
				$('table#userDictionary tr:last-child').addClass('last');
			}
		});
	}	
}
function deleteDictionaryItem(id) {
	$.ajax ({
		type: 	 "GET",
		url:	 "deleteItemAjax?set_ajax_view",
		data:	 "dictionary_id=" 		+ id,
		success: function(data) {
			$('table#userDictionary tr#' + id).remove();
			$('table#userDictionary tr').removeClass('last');
			$('table#userDictionary tr:last-child').addClass('last');
		}
	});
}